//
//  LevelGageItemCell.m
//  XTCloud
//
//  Created by QA on 2018/7/24.
//  Copyright © 2018年 ShangHai HaoLei Software Technology Co., Ltd. All rights reserved.
//

#import "LevelGageItemCell.h"

@implementation LevelGageItemCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"LevelGageItemCell" owner:self options:nil];
        self = [topLevelObjects objectAtIndex:0];
        [self drawProgress];
        [self drawRadius];
    }
    return self;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state
}

//绘制进状态（水波纹状态）
- (void)drawProgress {
    //波浪的背景，可以不要
    UIView *waveContainer = [[UIView alloc] initWithFrame:CGRectMake(90, 45, 95, 95)];
    waveContainer.backgroundColor = [UIColor colorWithRed:190/255.0f green:232/255.0f blue:231/255.0f alpha:0.8];
    waveContainer.layer.cornerRadius = waveContainer.bounds.size.width/2.0f;
    waveContainer.layer.masksToBounds = true;
    //waveContainer.center = self.view.center;
    [self.contentView addSubview:waveContainer];
    
    //初始化波浪，需要设置字体大小、字体颜色、波浪背景颜色、前层波浪颜色、后层博浪颜色
    _waveProgress = [[XLWaveProgress alloc] initWithFrame:CGRectMake(95, 40, 90, 90)];
    _waveProgress.center = CGPointMake(waveContainer.bounds.size.width/2.0f, waveContainer.bounds.size.height/2.0f);
    _waveProgress.progress = 0.0f;
    //波浪背景颜色，深绿色
    _waveProgress.waveBackgroundColor = [UIColor colorWithRed:96/255.0f green:159/255.0f blue:150/255.0f alpha:1]; //#609F96
    //前层波浪颜色
    _waveProgress.backWaveColor = [UIColor colorWithRed:136/255.0f green:199/255.0f blue:190/255.0f alpha:1];// #88C7BE
    //后层波浪颜色
    _waveProgress.frontWaveColor = [UIColor colorWithRed:28/255.0 green:203/255.0 blue:174/255.0 alpha:1]; // #1CCBAE
    //字体
    _waveProgress.textFont = [UIFont boldSystemFontOfSize:20];
    //文字颜色
    _waveProgress.textColor = [UIColor whiteColor];
    [waveContainer addSubview:_waveProgress];
    //开始波浪
    [_waveProgress start];
}

//状态按钮圆角
- (void)drawRadius {
    self.jlztRadius.layer.cornerRadius = 5;
    self.jlztRadius.layer.masksToBounds = true;
    
    self.ccztRadius.layer.cornerRadius = 5;
    self.ccztRadius.layer.masksToBounds = true;
    
    self.hlztRadius.layer.cornerRadius = 5;
    self.hlztRadius.layer.masksToBounds = true;
    
    self.bjztRadius.layer.cornerRadius = 5;
    self.bjztRadius.layer.masksToBounds = true;
}

@end
